package com.itheima.demo;

import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;

public class Demo01 {//实现键盘录入用户名和密码,本地永久存储(要换行)
    public static void main(String[] args) throws IOException {
        //实现键盘录入
        Scanner sc = new Scanner(System.in);
        System.out.println("请录入用户名");
        String username = sc.nextLine();
        System.out.println("请录入密码");
        String password = sc.nextLine();
        
        //创建字符输出流对象
        FileWriter fw = new FileWriter("day016\\a.txt");
        
        //写入数据
        fw.write(username);
        fw.write("\r\n");
        fw.write(password);

        //刷新
        fw.flush();
        
        //释放资源
        fw.close();
    }
}
